import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SizeListVO, SizeListForm, SizeListQuery } from '@/api/system/sizeList/types';

/**
 * 查询尺寸列，存储产品可用的尺寸选项列表
 * @param query
 * @returns {*}
 */

export const listSizeList = (query?: SizeListQuery): AxiosPromise<SizeListVO[]> => {
  return request({
    url: '/system/sizeList/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询尺寸列，存储产品可用的尺寸选项详细
 * @param id
 */
export const getSizeList = (id: string | number): AxiosPromise<SizeListVO> => {
  return request({
    url: '/system/sizeList/' + id,
    method: 'get'
  });
};

/**
 * 新增尺寸列，存储产品可用的尺寸选项
 * @param data
 */
export const addSizeList = (data: SizeListForm) => {
  return request({
    url: '/system/sizeList',
    method: 'post',
    data: data
  });
};

/**
 * 修改尺寸列，存储产品可用的尺寸选项
 * @param data
 */
export const updateSizeList = (data: SizeListForm) => {
  return request({
    url: '/system/sizeList',
    method: 'put',
    data: data
  });
};

/**
 * 删除尺寸列，存储产品可用的尺寸选项
 * @param id
 */
export const delSizeList = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/sizeList/' + id,
    method: 'delete'
  });
};
